package com.example.program.data.local

import android.content.Context
import androidx.room.Room
import com.example.program.utils.ROOM_NAME

class LocalDataSource {
    companion object{
        private var dao: RecipesDao? = null

        fun getDao(context: Context): RecipesDao{
            if (dao == null){
                val db = Room.databaseBuilder(context, RecipeDatabase::class.java, ROOM_NAME)
                    .build()
                dao = db.getRecipeDao()
            }
            return dao!!
        }
    }
}